package com.hksj.Intelligentmanagement.controller;

import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.dto.GasAlarmTrendDTO;
import com.hksj.Intelligentmanagement.dto.GasMonitoringDTO;
import com.hksj.Intelligentmanagement.dto.GasTrendDTO;
import com.hksj.Intelligentmanagement.service.GasMonitoringService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName GasMonitoringController
 * @Author zengke
 * @Date 2023/7/18 14:16
 */
@RestController
@Api(tags = "气体监控管理")
@RequestMapping("/api/gasMonitoring")
public class GasMonitoringController {

    @Autowired
    private GasMonitoringService gasMonitoringService;

    @ApiOperation("查询气体总览")
    @PostMapping("/queryMonitoringInfo")
    public Result queryGasMonitoringInfo(@RequestBody GasMonitoringDTO gasMonitoringDTO){
        return gasMonitoringService.queryGasMonitoringInfo(gasMonitoringDTO);
    }

    @ApiOperation("查询气体压力趋势")
    @PostMapping("/queryGasPressureTrend")
    public Result queryGasPressureTrend(@RequestBody GasTrendDTO gasTrendDTO){
        return Result.data(gasMonitoringService.queryGasPressureTrend(gasTrendDTO));
    }

    @ApiOperation("查询气体用量趋势")
    @PostMapping("/queryGasUsageTrend")
    public Result queryGasUsageTrend(@RequestBody GasTrendDTO gasTrendDTO){
        return gasMonitoringService.queryGasUsageTrend(gasTrendDTO);
    }

    @ApiOperation("查询气体压力告警趋势")
    @PostMapping("/queryGasAlarmPressureTrend")
    public Result queryGasAlarmPressureTrend(@RequestBody GasAlarmTrendDTO gasAlarmTrendDTO){
        return gasMonitoringService.queryGasAlarmPressureTrend(gasAlarmTrendDTO);
    }

    @ApiOperation("查询气体用量告警趋势")
    @PostMapping("/queryGasUsageAlarmTrend")
    public Result queryGasUsageAlarmTrend(@RequestBody GasAlarmTrendDTO gasAlarmTrendDTO){
        return gasMonitoringService.queryGasUsageAlarmTrend(gasAlarmTrendDTO);
    }

    @ApiOperation("导出医用气体压力趋势")
    @PostMapping("/exportGasPressureTrend")
    public void exportGasPressureTrend(@RequestBody GasTrendDTO gasTrendDTO, HttpServletResponse response){
        gasMonitoringService.exportGasPressureTrend(gasTrendDTO,response);
    }

    @ApiOperation("导出气体用量趋势")
    @PostMapping("/exportGasUsageTrend")
    public void exportGasUsageTrend(@RequestBody GasTrendDTO gasTrendDTO, HttpServletResponse response){
        gasMonitoringService.exportGasUsageTrend(gasTrendDTO,response);
    }

    @ApiOperation("导出气体压力告警趋势")
    @PostMapping("/exportGasPressureAlarmTrend")
    public void exportGasPressureAlarmTrend(@RequestBody GasTrendDTO gasTrendDTO, HttpServletResponse response){
         gasMonitoringService.exportGasPressureAlarmTrend(gasTrendDTO,response);
    }

    @ApiOperation("导出气体用量告警趋势")
    @PostMapping("/exportGasUsageAlarmTrend")
    public void exportGasUsageAlarmTrend(@RequestBody GasTrendDTO gasTrendDTO, HttpServletResponse response){
        gasMonitoringService.exportGasUsageAlarmTrend(gasTrendDTO,response);
    }
}
